package com.example.producer.produce;



import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Random;
import java.util.UUID;

/**
 * @author shuc001
 * @Date 2018/9/27 下午2:28
 */
@Component
public class FastSend {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void send(Object message){
        CorrelationData cd = new CorrelationData();
        cd.setId(UUID.randomUUID().toString());
        Message<Object> msg = MessageBuilder.createMessage(message, new MessageHeaders(null));
        rabbitTemplate.convertAndSend("fast_ex","fast.a",msg,cd);
    }
}
